Field of the Invention
The present invention relates to the field of microcontrollers embedded in electronic elements and to the implementation of atomic transactions in such devices. More specifically, the present invention relates to a method for writing into or reading from an atomicity memory.
Discussion of the Related Art
In embedded microcontrollers, for example, contact or contactless chip cards, the atomicity of transactions is essential. A transaction is said to be atomic if, when it is under way and an interrupt occurs, for example, due to an interruption of the device power supply, the data stored in a non-volatile memory are, after the device has been reactivated, either in the state prior to the transaction, or in the final state after the transaction. If the state of several sets of memory cells has to be changed during a transaction, all the memory cells should be updated or reset to their state prior to the transaction. For an atomic transaction, an intermediary or undetermined state of areas storing the data of this transaction in the non-volatile memory must not be allowed.
Many techniques are known to determine whether a transaction has occurred properly and whether the state of the non-volatile memories to which it has been accessed has been updated properly. To perform atomic transactions, it is current to use a memory area of the non-volatile memory, which is called “atomicity memory (or buffer)”, to store, before each transaction, the state of the non-volatile memories capable of being modified during the transaction. This enables, in the case where the transaction would be interrupted, to restore in non-volatile memories all the data preceding the transaction by reinjecting the data stored in the atomicity buffer. It is also known to store, in an atomicity buffer and before each transaction, the new data intended to be stored in the non-volatile memories at the end of the transaction. If the transaction is interrupted, the data stored in the atomicity buffer enable to complete the transaction.
In the case where the transaction has succeeded, the data contained in the atomicity buffer are erased. Generally, atomicity buffers are formed of electrically erasable and programmable non-volatile memories, better known as EEPROMs.
A problem of the use of EEPROMs is that such memories are unable to withstand a number of write operations greater than 500,000 cycles and tend to degrade along write and erase operations. Further, the degradation of the buffer memories is not uniform since the number of data to be written into the atomicity buffer varies according to the performed transactions. Thus, the first memory areas (first memory addresses) of the atomicity buffer are reached for each transaction while the last memory areas are only used in transactions modifying the state of a large number of memory cells.
Thus, a buffer formed of EEPROMs non-uniformly degrades along write and read operations.